package com.itheima.anno;

import com.itheima.validation.StateValidation;

import javax.validation.Constraint;
import javax.validation.Payload;
import java.lang.annotation.*;

import static java.lang.annotation.ElementType.FIELD;
import static java.lang.annotation.RetentionPolicy.RUNTIME;

@Documented //元注解
@Target({FIELD})//元注解
@Retention(RUNTIME)
@Constraint(validatedBy = {StateValidation.class})//元注解 和validation文件夹中的注解联系起来 指定提供校验规则的类
public @interface State {
    //提供校验失败后的相关提示
    String message() default "state参数的值只能是已发布或者草稿";
    //指定分组
    Class<?>[] groups() default {};
    //负载 获取到state注解的附加信息
    Class<? extends Payload>[] payload() default {};
}
